/****************************************************************************
**
** Copyright (C) 2009-2010 Mist Poryvaev.
** All rights reserved.
** Contact: Mist Poryvaev (mist.poryvaev@gmail.com)
**
** This file is part of the RailWorm project.
**
****************************************************************************/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>
#include <QtNetwork>
#include "queryform.h"
#include "parsetraindata.h"
#include "setupproxy.h"
#include "setuplogon.h"
#include "ordertickets.h"
#include "htmlgenie.h"

namespace Ui
{
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
	HtmlGenie jinn;
	QSplashScreen * m_Splash;
	QueryForm * m_QueryForm;
	SetupProxy * m_SetupProxy;
	SetupLogon * m_SetupLogon;
	OrderTickets * m_OrderTickets;
	ParseTrainData m_Parser;
	QLabel * m_Info;
	QProgressBar * m_Progress;
	QPushButton * m_Cancel;
	void closeEvent(QCloseEvent * ce);
	FirmTrainsList m_FirmTrains;
	void UpdateTitle(const QString & From = QString(), const QString & To = QString());
private slots:
	void on_actionPrint_triggered();
 void on_actionLogon_triggered();
	void on_actionOptions_triggered();
	void on_actionSeatsDetailsVisible_triggered(bool checked);
	void on_actionAbout_triggered();
	void on_actionCollapse_triggered(bool checked);
	void on_actionNewQuery_triggered();
	void OnError(const QString & Text);
	void OnProgressUpdate(qint64 Done, qint64 Total);
	void OnFinished();
//	void OnFirmTrainsPageFinished(QString Response, int Id, bool _Error);
	void OnProxyChanged(QString Address, QString Port);
	void OnQueryStarted();

	void OnFirmTrainsPageFinished(HtmlResponse * _response, int _id, bool _error);

	void RequestFirmTrains();
signals:
	void NeedRequestFirmTrains();
};

#endif // MAINWINDOW_H
